package br.com.cadele.beans;

import java.io.Serializable;
import java.util.ArrayList;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import br.com.cadele.model.Turma;
import br.com.cadele.service.TurmaService;

import com.ocpsoft.pretty.faces.annotation.URLBeanName;
import com.ocpsoft.pretty.faces.annotation.URLMapping;
@ManagedBean(name="visualizarTurmaBean")
@ViewScoped
@URLBeanName(value="visualizarTurmaBean")
@URLMapping(id="visualizarTurmaBean", pattern="/turma/visualizar", viewId="/pages/turma/visualizar.xhtml")
public class VisualizarTurmaBean implements Serializable {

	
	private static final long serialVersionUID = 3626654489121736969L;
	private Turma turma;
	private TurmaService turmaService;
	private ArrayList<Turma> turmaList;
	
	@PostConstruct
    public void init(){
    	turmaService = new TurmaService();
        turmaList = turmaService.getAll();
    }
    
    public void salvar() {
    	turmaService.executeInsert(turma);
    }
    
    public ArrayList<Turma> getCursoList(){
      return turmaList;
    }
    
    public void setCursoList(ArrayList<Turma> turmaList){
      this.turmaList = turmaList;
    }
}
